package Java道题;

import java.util.Arrays;
/**
 *
 * @author hunbird
 * 1 2		1 0		3 0
 * 		* 		=
 * 1 2 		1 0		3 0
 *
 */
public class 矩阵连乘 {
	public  static void matrixMultiply(int[][] a,int[][] b) {

		int ar=a.length,br=b.length;
		int ac=a[0].length,bc=b[0].length;

		int[][] c=new int[ar][bc];
		for(int i=0;i<ar;i++) {
			for(int j=0;j<bc;j++) {
				int sum=0;
				for(int k=0;k<ac;k++) {
					sum+=a[i][k]*b[k][j];

				}

				c[i][j]=sum;
				System.out.print(sum+" ");

			}
			System.out.println();
		}

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int[][] a= {{1,2},{1,2}};
		int[][] b= {{1,0},{1,0}};
		matrixMultiply(a,b);
	}

}
